/**
 * 
 */
package vn.com.demand.lux.view.labelprovider;

import vn.com.demand.lux.model.WarrantyExpenseAccrualBean;
import vn.com.demand.util.DpUtils;

/**
 * @author Huynh Tan Tai <httcntt@yahoo.com>
 *
 */
public class WarrantyExpenseAccrualLabelProvider extends BasicLabelProvider {

	public String getColumnText(Object element, int columnIndex) {
		String numberFormat = "###,###,###,###.00";
		Double value = null;
		WarrantyExpenseAccrualBean bean = (WarrantyExpenseAccrualBean)element;
		switch (columnIndex) {
		case 0:
			return bean.getContractNumber();
		case 1:
			return bean.getType();
		case 2:
			return bean.getCostCenter();
		case 3:
			value = bean.getNetSales();
			return value != null && value != 0.0? DpUtils.format(value, numberFormat) : "";
		case 4:
			value = bean.getWarrantyExpense();
			return value != null && value != 0.0 ? DpUtils.format(value, numberFormat) : "";
		default:
			break;
		}
		return "";
	}
}
